#include "PLDataTypes.h"

/**
  *	A matrix coordinate referring to an element in a matrix with a particular
  * (row, column) pair
  */
class PLMatrixCoordinate
{
public:
	PLMatrixCoordinate( const PLuint &_row, const PLuint &_col ) :
	  row( _row ),
		  col( _col ) {};

	  /**
	    * An instance of PLMatrixCoordinateCompare is used as a compare object
		* in an stl container
	    */
	  static class PLMatrixCoordinateCompare
	  {
	  public:
		  /**
		    * Compares the two matrix coordinates and returns true, if the first
			* coordinate is smaller than the second, false otherwise. To decide
			* which one of them is smaller, at first the first elements of the
			* coordinates are compared, than the second ones.
			*
			* @param first first matrix coordinate in the comparison
			* @param second second matrix coordinate in the comparison
			* @return true, if the first coordinate is smaller than the second, false otherwise
		    */
		  bool operator()( const PLMatrixCoordinate &first, const PLMatrixCoordinate &second )
		  {
			  if (first.row < second.row)
			  {
				  return true;
			  }
			  else if (first.row > second.row)
			  {
				  return false;
			  }
			  else
			  {	// Equal rows, check the cols
				  if (first.col < second.col)
				  {
					  return true;
				  }

				  return false;
			  }
		  }
	  };

	  /**
	    * Returns the row element of this matrix coordinate
		*
		* @return row element of this matrix coordinate
	    */
	  const PLuint &Row( void ) const
	  {
		  return row;
	  }

	  /**
	    * Returns the column element of this matrix coordinate
		*
		* @return column element of this matrix coordinate
	    */
	  const PLuint &Col( void ) const
	  {
		  return col;
	  }

private:
	/** row element of the matrix coordinate */
	PLuint row;
	/** column element of the matrix coordinate */
	PLuint col;
};